<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
<!--
Copyright 2008, 2009, 2010 Miguel Ángel Laguna Lobato

This file is part of Multiclinical Trial Web-PACS.

Multiclinical  Trial Web-PACS is free  software: you  can redistribute 
it and/or modify it under  the terms of the GNU General Public License 
as published by the Free  Software Foundation, either version 3 of the 
License, or (at your option) any later version.

Multiclinical  Trial Web-PACS is distributed  in the hope that it will 
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
of  MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
General Public License for more details.

You should have received a copy of the GNU General Public License
along with Multiclinical Trial Web-PACS.  If not, see 
<http://www.gnu.org/licenses/>. 
 -->

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:p="http://primefaces.prime.com.tr/ui">

<ui:composition template="/jsp/include/templateEditionRsc.xhtml">

	<ui:define name="saveState">
		<t:saveState value="#{tasksBean.taskListMode}"/>
		<t:saveState value="#{taskBean.possibleUsers}" />
		<t:saveState value="#{taskBean.task}"/>
	</ui:define>

	<ui:define name="title">
		<h3><h:outputText value="#{msgs['jsf.headers.TaskDetail']} #{taskBean.task.code} - [#{taskBean.task.status}]" />
		</h3>
	</ui:define>

	<ui:define name="editionForm">
	
		<p:accordionPanel>
			<p:tab title="Comentarios">
				<!-- Tabla de comentarios y evolución de la tarea -->
				<t:dataTable id="commentsTable" 
					rendered="#{not empty taskBean.task.logs}"
					styleClass="resTabla" headerClass="resCabecera" 
					footerClass="pieTablaEstandar"
					value="#{taskBean.task.logs}" var="row">
					
					<h:column>
						<h:panelGrid columns="4" styleClass="cuerpo">
							<h:outputLabel styleClass="frmLabelHeader" value="#{msgs['jsf.generic.Author']}:"/>
							<h:outputText value="#{row.author.fullName}"/>
							<h:outputLabel styleClass="frmLabelHeader" value="#{msgs['jsf.generic.Date']}:"/>
							<h:outputText value="#{row.stamp}">
								<f:convertDateTime pattern="dd/MM/yyyy - HH:mm:ss" timeZone="Europe/Madrid"/>
							</h:outputText>
							<h:outputLabel styleClass="frmLabelHeader" value="#{msgs['jsf.generic.Field']}:"/>
							<h:outputText value="#{row.field}"/>
							<h:outputLabel styleClass="frmLabelHeader" value="#{msgs['jsf.generic.Value']}:"/>
							<h:outputText value="#{row.value}">
								<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Europe/Madrid"/>
							</h:outputText>
						</h:panelGrid>
			
						<h:panelGrid columns="1" styleClass="cuerpo" rendered="#{row.comment != null}">
							<h:inputTextarea value="#{row.comment}" disabled="true" cols="60"/>
						</h:panelGrid>
						
						<hr/>
						
					</h:column>
					
				</t:dataTable>
			</p:tab>
		</p:accordionPanel>
		
		<br/>
		
		<p:panel>
			<h:panelGrid columns="6" styleClass="cuerpo">
				
				<h:outputLabel 
					for="owner" 
					styleClass="frmLabel" 
					value="#{msgs['jsf.generic.Owner']}" />
				<h:selectOneMenu 
					id="owner" 
					styleClass="frmSelectOne"
					value="#{taskBean.newOwner}">
					<f:selectItems value="#{taskBean.possibleUsers}"/>
				</h:selectOneMenu>
				<t:message 
					id="ownerError" 
					style="frmLabelError" 
					for="owner" 
					styleClass="error"/>
	
				<h:outputLabel 
					for="status" 
					styleClass="frmLabel" 
					value="#{msgs['jsf.generic.Status']}" />
				<h:selectOneMenu 
					id="status"
					styleClass="frmSelectOne" 
					value="#{taskBean.task.status}">
					<f:selectItem itemLabel="" itemValue="#{null}" />
					<f:selectItems value="#{taskBean.stateLst}" />
				</h:selectOneMenu>
				<t:message 
					id="statusError" 
					style="frmLabelError" 
					for="status" 
					styleClass="error"/>
				
				<h:outputLabel 
					for="fecha" 
					styleClass="frmLabel" 
					value="#{msgs['jsf.generic.EndDate']}"/>
				<p:calendar
					id="fecha"
					styleClass="frmInput"
					value="#{taskBean.task.endDate}"
					timeZone="Europe/Madrid"
					pattern="dd/MM/yyyy" />
				<t:message 
					id="fechaError" 
					style="frmLabelError" 
					for="fecha" 
					styleClass="error"/>
				
			</h:panelGrid>
	
			<h:panelGrid columns="1" styleClass="cuerpo" >
				<h:outputLabel for="comment" styleClass="frmLabel" value="#{msgs['jsf.generic.Comment']}"/>
				<h:inputTextarea id="comment" value="#{taskBean.taskComment}" cols="60"/>
			</h:panelGrid>
		</p:panel>
		
		<br/>
		
	</ui:define>

	<ui:define name="buttonsForm">
		<h:panelGrid columns="2">
			<h:commandButton 
				id="save" 
				styleClass="frmButton" 
				value="#{msgs['jsf.actions.Save']}" 
				action="#{taskBean.accSaveTask}"/>
			<h:commandButton 
				id="delete" 
				styleClass="frmButton" 
				value="#{msgs['jsf.actions.Delete']}"
				rendered="#{taskBean.task.code > 0}"
				action="#{taskBean.accDeleteTask}"/>
		</h:panelGrid>
	</ui:define>

</ui:composition>
</html>